package constructor;

public class Student1 {
    private String name;
    private int age;


    @Override
    public String toString() {
        return "Student1{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }

    // 公共的无参构造方法
    public Student1() {
    }

    // 私有的有参构造方法
    private Student1(String name) {
        this.name = name;
    }

    // 公共的有参构造方法
    public Student1(String name, int age) {
        this.name = name;
        this.age = age;
    }

}
